package neptune.web.server.operations;

import it.robertobifulco.ias.IncorrectParamsException;
import it.robertobifulco.ias.Operation;

public class OpenRandomSSHRedirectPort implements Operation 
{
	public static String ID = "OpenRandomSSHRedirectPort";

	public Object[] execute(Object[] args) throws IncorrectParamsException, Exception 
	{
		/*		// TODO  DA IMPLEMENTARE
		String ipServer=(String)args[0];
		Random rand=new Random();
		// Calcolo una porta casuale
		int port=rand.nextInt(4000)+2000;
		Runtime rt = Runtime.getRuntime();
		String processo="redir --lport "+port+" --cport 22 --caddr "+ipServer+" --timeout 60";
		// Redirigo la porta
		rt.exec(processo);
		return new Object[] { String.valueOf(port) };
		*/
		return new Object[] { "22" };
	}

	public String getDescription() 
	{
		return "Opena a random port for redirect ssh connection";
	}

	public String getID() 
	{
		return ID;
	}

}
